package top.xierongsheng.code.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {

    @Value("${springdoc.title}")
    private String title;

    @Value("${springdoc.version}")
    private String version;

    @Value("${springdoc.name}")
    private String name;

    @Value("${springdoc.description}")
    private String description;

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI().info(new Info().title(title)
                .version(version).contact(new Contact().name(name)).description(description));
    }
}
